package com.loiot.baqi.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.loiot.baqi.pojo.ZpAccountSalaryHistory;

/**
 * 文件上传下载 访问层。
 * 
 * @author  rick 
 * @creation 2016-10-26
 */
@Repository("zpAccountSalaryHistoryDao")
public class ZpAccountSalaryHistoryDao extends SqlSessionDaoSupport{
    
    /**
     * 添加 文件上传下载
     * 
     * @param p 参数对象
     */
    public ZpAccountSalaryHistory addZpAccountSalaryHistory(ZpAccountSalaryHistory p)throws Exception {
        this.getSqlSession().insert("ZpAccountSalaryHistory.addZpAccountSalaryHistory", p);
        return p;
    }
    
    /**
     * 修改 文件上传下载
     * 
     * @param p 参数对象
     */
    public void updateZpAccountSalaryHistory(ZpAccountSalaryHistory p)throws Exception {
        this.getSqlSession().update("ZpAccountSalaryHistory.updateZpAccountSalaryHistory", p);
    }
    
    /**
     * 修改 文件上传下载
     * 
     * @param p 参数对象
     */
    public void updateZpAccountSalaryHistory(HashMap<String,Object> pMap)throws Exception {
        this.getSqlSession().update("ZpAccountSalaryHistory.updateZpAccountSalaryHistoryByMap", pMap);
    }
    
    
    
    /**
     * 删除  文件上传下载
     * 
     * @param id 主键
     */
    public void deleteZpAccountSalaryHistory(java.lang.Long id)throws Exception {
        getSqlSession().delete("ZpAccountSalaryHistory.deleteZpAccountSalaryHistory", id);
    }
    
    /**
     * 删除  文件上传下载
     * 
     * @param id 主键
     */
    public void deleteZpAccountSalaryHistory(ZpAccountSalaryHistory p)throws Exception {
        getSqlSession().delete("ZpAccountSalaryHistory.deleteZpAccountSalaryHistory", p);
    }
    
    /**
     * 获得  文件上传下载
     * 
     * @param id 文件上传下载Id
     * 
     * @return 返回与ID匹配的文件上传下载
     */
    public ZpAccountSalaryHistory getZpAccountSalaryHistoryById(java.lang.Long id)throws Exception {
    	HashMap<String, Object> pMap = new HashMap<String, Object>();
    	pMap.put("id", id);
    	return (ZpAccountSalaryHistory) getSqlSession().selectOne("ZpAccountSalaryHistory.getZpAccountSalaryHistoryById", pMap);
    }
    
    /**
     * 获得  文件上传下载
     * 
     * @param id 文件上传下载Id
     * 
     * @return 返回与ID匹配的文件上传下载
     */
    public ZpAccountSalaryHistory getZpAccountSalaryHistoryById(java.lang.Long id,Long accountId)throws Exception {
    	HashMap<String, Object> pMap = new HashMap<String, Object>();
    	pMap.put("id", id);
    	pMap.put("inPerson", accountId);
    	return (ZpAccountSalaryHistory) getSqlSession().selectOne("ZpAccountSalaryHistory.getZpAccountSalaryHistoryById", pMap);
    }
    
    /**
     * 获得  文件上传下载
     * 
     * @param id 文件上传下载Id
     * 
     */
    public ZpAccountSalaryHistory getZpAccountSalaryHistory(HashMap<String,Object> pMap)throws Exception {
    	return (ZpAccountSalaryHistory) getSqlSession().selectOne("ZpAccountSalaryHistory.queryZpAccountSalaryHistoryList", pMap);
    }
    
    /**
     * 获得  文件上传下载
     * 
     * @param name 文件上传下载名称
     * 
     * @return 返回与NAME匹配的文件上传下载
     */
    public ZpAccountSalaryHistory getZpAccountSalaryHistoryByName(String name)throws Exception {
        return null;
        //return (ZpAccountSalaryHistory) getSqlSession().selectOne("ZpAccountSalaryHistory.getZpAccountSalaryHistoryByName", name);
    }
    
    
    
    /**
     * 查询  文件上传下载列表条数
     * 
     * @param name 文件上传下载名称
     * @return 文件上传下载列表条数
     */
    
    public int getZpAccountSalaryHistoryListCount(HashMap<String,Object> pMap)throws Exception {
        return (Integer) getSqlSession().selectOne("ZpAccountSalaryHistory.getZpAccountSalaryHistoryListCount", pMap);
    }

    /**
     * 查询 文件上传下载列表
     * 
     * @param name 文件上传下载名称
     * @param skipResults 跳过的记录数
     * @param maxResults 最大的记录数
     * @return 文件上传下载列表
     */
    public List<ZpAccountSalaryHistory> queryZpAccountSalaryHistoryList(HashMap<String, Object> pMap, int skipResults, int maxResults)throws Exception {
    	pMap.put("skipResults", skipResults);
    	pMap.put("maxResults", maxResults);
        return getSqlSession().selectList("ZpAccountSalaryHistory.queryZpAccountSalaryHistoryList", pMap);
    }
    
    /**
     * 查询 文件上传下载列表
     * 
     * @param pMap 参数列表
     */
    public List<ZpAccountSalaryHistory> queryZpAccountSalaryHistoryList(HashMap<String, Object> pMap)throws Exception {
        return getSqlSession().selectList("ZpAccountSalaryHistory.queryZpAccountSalaryHistoryList", pMap);
    }
    
    /**
     * 查询 文件上传下载列表
     * 
     * @return 文件上传下载列表
     */
    public List<ZpAccountSalaryHistory> queryZpAccountSalaryHistoryList()throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
        return getSqlSession().selectList("ZpAccountSalaryHistory.queryZpAccountSalaryHistoryList",params);
    }
    
    /**
     * 查询 文件上传下载列表
     * 
     * @return 文件上传下载列表
     */
    public List<ZpAccountSalaryHistory> queryZpAccountSalaryHistoryList(ZpAccountSalaryHistory p )throws Exception {
        return getSqlSession().selectList("ZpAccountSalaryHistory.queryZpAccountSalaryHistoryList",p);
    }
    
    /**
     * 统计 文件上传下载列表
     * 
     * @return 文件上传下载列表
     */
    public List<HashMap<String,Object>> statisticsZpAccountSalaryHistoryInfo(HashMap<String, Object> pMap )throws Exception {
    	List<HashMap<String,Object>> p = null; 
    	p =(List)getSqlSession().selectList("ZpAccountSalaryHistory.statisticsZpAccountSalaryHistoryInfo",p);
    	return p;
    }
    
    
    
    /**
     * TODO: 统计用户的薪资合计
     * @Auhor: RICK
     * @Date : 2016年10月26日
     */
    public long getZpAccountSalaryHistorySum(HashMap<String,Object> pMap)throws Exception {
        return (Integer) getSqlSession().selectOne("ZpAccountSalaryHistory.getZpAccountSalaryHistorySum", pMap);
    }

    
    

}
